The present disclosure relates to techniques for testing a software application associated with a database. More specifically, the present disclosure relates to a technique for testing a software application associated with a database without committing data into the database by modifying transaction scopes of transactions with the database.
Many software applications store and retrieve data from associated databases. In order to ensure proper operation when changes to a software application are deployed, it is often necessary to test the software application in conjunction with its associated database. For example, when testing a payroll software application, the associated database may be set up with the data that is needed during the testing, such as the current employees of a company. Then, the test may be performed by running payroll for the company. Moreover, the resulting data in the database may be validated to confirm that it matches what is expected based on business logic associated with the payroll software application. Next, regardless of whether the test succeeded or failed, the data in the database may be cleaned up so that the database can be reused in additional testing.
However, it can be difficult to restore the database to its initial state prior to the testing because the testing may leave the database in a ‘bad’ state. In particular, after the testing is completed, the data in the database may be very different than the initial state of the database. Correcting all of the changes to the database that occurred during the testing can be time-consuming and expensive.
For example, restarting the database after each test can significantly increase the time needed for testing and, thus, is usually very expensive. Alternatively, the database may be restored by ‘undoing’ the data that was committed or stored in the database during the testing. However, it can be very difficult to correctly undo changes. This is especially the case when a failure occurred during the testing, which can leave the database in an unknown state, and thus can result in additional test failures that necessitate future cleanup operations.